--- title: "L1-027 出租" created: 2025-11-28 tags: - 算法 --- # L1-027 出租 ## 题目 L1-027 出租 ![[image-646f55ea.png]] ## 思路分析 ## 代码实现 ```cpp #include using namespace std; #define endl '\n' #define int long long using ll = long long; using ull = unsigned long long; using PII = pair; using Pll = pair; int dx[4]={-1,0,1,0},dy[4]={0,1,0,-1}; const int inf=0x3f3f3f3f; const int N=20; vector arr,idx; set contains; signed main(){ ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); //给定字符串中有哪些数字 降序输出 //记录每个原位置的数在新降序数组中的位置 // 要维护 原位置 以及排序后的位置 用到pair 不是很好搞 // 干脆打暴力 对每个数去找新位置 string s;cin>>s; for(auto c:s) contains.insert(c-'0'); for(auto n:contains) arr.push_back(n); reverse(arr.begin(),arr.end()); cout<<"int[] arr = new int[]{"; for(int i=0;i